#ifndef __CONFIG_IMPORT_H__
#define __CONFIG_IMPORT_H__

#include <map>
#include <vector>

#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstring>
/***************************************************
 * mode name:ConfigImport
 * brief:
 * @author yxt
 * @created 2024/01/05 09:45:36
 * @imfor ~/bigSystem/Emotion/include/ConfigImport.h
 * @modify:
 *          配置文件导入
 * 		
***************************************************/

#define FILTER_CACHE        0x08
#define FILTER_REFRESH      0x04
#define COR_CACHE           0x02
#define COR_REFRESH         0x01


enum{
    data_char,
    data_short,
    data_int,
    data_long,
    data_float,
    data_double
}dataType_Enum;

class  ConfigImport
{
public:
    // 获取单实例对象
    static ConfigImport *getInstance();
    // static ConfigImport *getInstance(std::string yaml_loadFile = "../yaml/loadFile.yaml");
    //释放单实例，进程退出时调用
    static void deleteInstance();

private:
    // 将其构造和析构成为私有的, 禁止外部构造和析构
    // ConfigImport();
    ConfigImport(std::string yaml_loadFile = "../yaml/loadFile.yaml");
    ~ConfigImport();

    // 将其拷贝构造和赋值构造成为私有函数, 禁止外部拷贝和赋值
    ConfigImport(const ConfigImport &signal);
    const ConfigImport &operator=(const ConfigImport &signal);

private:
    // 唯一单实例对象指针
    static ConfigImport *m_SingleInstance;

public:
    /* data */
    // 配置文件属性列表
    std::map<std::string, std::string> configMap;
    std::vector<unsigned int> dim;
    std::vector<unsigned int> test_dim;

public:
    std::string getMapVal(std::string key);

    bool get_GL_Cache() const;
    bool get_CL_Cache() const;
    bool is_filter_cache_enable() const;
    bool is_filter_cache_refresh() const;
    bool is_cor_cache_enable() const;
    bool is_cor_cache_refresh() const;
    bool use_simulationDev() const;
    // int getpointPerTrial() const;

// 静态引用，减少函数堆栈
public:
    const int &pointPerTrial;
    const uint8_t &channalNum;
    const double &ntPercent;


private:
    // void getEmotionFiltParaFromMatlab(void);
    bool GL_Cache;
    bool CL_Cache;
    // 启动仿真设备
    bool simulation_enable;
    // 每个trail的点数
    int m_pointPerTrial;

    // 缓存控制寄存器
    // +--------+---------------+-------------------+-----------+---------------+
    // |  0-3   |      4        |         5         |     6     |       7       |
    // +--------+---------------+-------------------+-----------+---------------+
    // |   --   | filter_cache  |   filter_refresh  | cor_cache |  cor_refresh  |
    // +--------+---------------+-------------------+-----------+---------------+
    uint8_t cacheConfig_reg;

    // 脑电通道数
    uint8_t m_channalNum;
    // 网络显示系数百分比
    double networkShows_SparsePercent;


};

#endif // !__CONFIG_IMPORT_H__


